#include "stdafx.h"
#include "TestHandle.h"


CLASS_IMPLEMENT_EX (CDataInterface, TestHandle)


TestHandle::TestHandle(void)
{
}

TestHandle::~TestHandle(void)
{
}

static AmfObjectPtr pOutData;
static int tt1 = GetTickCount();
static int tt1CallCount = 0;
AmfObjectPtr WINAPI TestHandle::Test1( LPCWSTR p1, int32 p2, float32 p3 )
{
	//if (NULL == pOutData)
	//{
	//	Amf3XML xml;
	//	pOutData = xml.readObject("out_data.xml");
	//}

	AmfArrayPtr parr(HP_NEW) ;
	parr->AddData(p1);
	parr->AddData(p2);
	parr->AddData(p3);
	//parr->AddData(pOutData);

	++tt1CallCount;
	if (GetTickCount() - tt1 > 5000)
	{
		LOG4CXX_INFO(Logger::getRootLogger(), "Test1, Process " << tt1CallCount << " Request Per Second.");
		tt1 = GetTickCount();
		tt1CallCount = 0;
	}

	return parr;
}

AmfObjectPtr WINAPI TestHandle::Test2( LPCWSTR p1, int32 p2, AmfDatePtr p3 )
{
	AmfArrayPtr parr(HP_NEW) ;
	parr->AddData(p1);
	parr->AddData(p2);
	parr->AddData(p3);

	static int tt = 0;
	if ((tt++ % 100) == 0)
		LOG4CXX_INFO(Logger::getRootLogger(), "Test2, Process " << tt << " Request");
	return parr;
}